﻿@model IEnumerable<Models.ItemList>

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <environment include="Development">
        <link rel="stylesheet" href="~/layer/css/layui.css" media="all" />
        <link rel="stylesheet" href="~/layer/css/admin.css" media="all" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="~/layer/css/layui.css" asp-append-version="true" media="all" />
        <link rel="stylesheet" href="~/layer/css/admin.css" asp-append-version="true" media="all" />
    </environment>
</head>
<body id="iosiframe">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                @if (ViewBag.User != null && ViewBag.User.UserType == Code.UserTypes.普通用户) {
                    Models.Users user = ViewBag.User;
                    <div class="layui-card">
                        <div class="layui-card-header">用户信息</div>
                        <div class="layui-card-body">
                            <div class="layadmin-backlog layadmin-shortcut">
                                <div carousel-item>
                                    <ul class="layui-row layui-col-space10">
                                        <li class="layui-col-xs12">
                                            <a lay-href="@Url.Action("detail", "account", new { Id = user.Id })" class="layadmin-backlog-body" title="个人资料">
                                                <h3>用户编号</h3>
                                                <p><cite>@user.UserCode</cite></p>
                                            </a>

                                        </li>
                                        <li class="layui-col-xs6">
                                            <a lay-href="@Url.Action("productinfo", "order")" class="layadmin-backlog-body">
                                                <i class="layui-icon layui-icon-cart"></i>
                                                <cite>购买商品</cite>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs6">
                                            <a lay-href="@Url.Action("recommend", "account")" class="layadmin-backlog-body">
                                                <i class="layui-icon layui-icon-user"></i>
                                                <cite>推荐代理</cite>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs6">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>用户等级</h3>
                                                <p><cite style="font-size:27px;">@user.Level</cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs6">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>团队人数</h3>
                                                <p><cite style="font-size:27px;">@user.TeamCount</cite></p>
                                            </a>
                                        </li>
                                        @if (ViewBag.Province != null) {
                                            <li class="layui-col-xs12">
                                                <a href="javascript:;" class="layadmin-backlog-body">
                                                    <h3>代理省份</h3>
                                                    <p><cite>@ViewBag.Province.name</cite></p>
                                                </a>
                                            </li>
                                        }
                                        @if (ViewBag.Province != null) {
                                            <li class="layui-col-xs12">
                                                <a href="javascript:;" class="layadmin-backlog-body">
                                                    <h3>代理城市</h3>
                                                    <p><cite>@ViewBag.City.name</cite></p>
                                                </a>
                                            </li>
                                        }
                                        <li class="layui-col-xs12">
                                            <a href="javascritp:;" class="layadmin-backlog-body">
                                                <h3>奖金余额</h3>
                                                <p><cite style="color:#f8a30a">@user.Overage.ToString("C")</cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs12">
                                            <a href="javascritp:;" class="layadmin-backlog-body">
                                                <h3>奖金累计</h3>
                                                <p><cite style="color:#b90d0d">@ViewBag.Total.ToString("C")</cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs12">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>推荐人数</h3>
                                                <p><cite>@ViewBag.RecommendCount</cite></p>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                } else {
                    <div class="layui-card">
                        <div class="layui-card-header">经营情况</div>
                        <div class="layui-card-body">
                            <div class="layadmin-backlog layadmin-shortcut">
                                <div carousel-item>
                                    <ul class="layui-row layui-col-space10">
                                        <li class="layui-col-xs12">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>总收入</h3>
                                                <p><cite style="color:#f8a30a">@ViewBag.Total</cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs12">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>总支出</h3>
                                                <p><cite style="color:#b90d0d">@ViewBag.payTotal</cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs12">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>总订单数</h3>
                                                <p><cite>@ViewBag.orderCount <span style="font-size:20px;">条</span></cite></p>
                                            </a>
                                        </li>
                                        <li class="layui-col-xs12">
                                            <a href="javascript:;" class="layadmin-backlog-body">
                                                <h3>总销售</h3>
                                                <p><cite>@ViewBag.salesVol / <span style="font-size:20px;">20箱</span></cite></p>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card">
                        <div class="layui-card-header">当月收入</div>
                        <div class="layui-card-body">
                            <div class="layui-carousel layadmin-carousel layadmin-dataview" id="main">

                            </div>
                        </div>
                    </div>
                }
            </div>
        </div>
        <script src="~/layer/layui.js"></script>
        <script>
            layui.config({
                base: '../../layer/' //静态资源所在路径
            }).extend({
                index: 'index' //主入口模块
                }).use(['index', 'echarts'], function () {
                    var $ = layui.$
                        , echarts;

                    var ua = navigator.userAgent.toLowerCase();
                    var screenwidth = window.screen.width;
                    if (!/iphone|ipad|ipod/.test(ua)) {
                        $("#iosiframe").attr("scrolling", "auto");
                    } else {
                        $('#iosiframe').width(screenwidth + 'px');
                    }

                    if ($('#main') && $('#main').length > 0) {
                        echarts = layui.echarts.init($('#main')[0]);

                        echarts.setOption({
                            color: ["#009688", "#1E9FFF", "#5FB878", "#FFB980", "#D87A80", "#8d98b3", "#e5cf0d", "#97b552", "#95706d", "#dc69aa", "#07a2a4", "#9a7fd1", "#588dd5", "#f5994e", "#c05050", "#59678c", "#c9ab00", "#7eb00a", "#6f5553", "#c14089"],
                            toolbox: {
                                show: true,
                                feature: {
                                    magicType: { type: ['line', 'bar'] },
                                    restore: {},
                                    saveAsImage: {}
                                }
                            }
                        });

                        $.ajax({
                            url: '@Url.Action("IncomeCharts", "api")',
                            dataType: 'json',
                            contentType: 'application/json',
                            type: 'get',
                            beforeSend: function () {
                                echarts.showLoading({
                                    text: '加载中',
                                    color: '#009688',
                                    textColor: '#000',
                                    maskColor: 'rgba(255, 255, 255, 0.8)',
                                    zlevel: 0
                                });
                            }
                        }).fail(function (jqXHR, textStatus, errorThrown) {
                            alert(errorThrown, { icon: 2, title: textStatus });


                            echarts.hideLoading();
                        }).done(function (res) {
                            var data = res.data;
                            if (res.code == 0) {
                                var option = data.echarts;

                                echarts.setOption(option);
                            }

                            echarts.hideLoading();
                        }).always(function () {
                            echarts.hideLoading();
                        });;
                    }
                });
        </script>
</body>
</html>
